package com.scommunity.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.scommunity.admin.vo.HouseQO;
import com.scommunity.domain.House;
import org.apache.ibatis.annotations.*;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Mapper
@Transactional(rollbackFor = Exception.class)
public interface HouseMapper extends BaseMapper<House> {
    List<House> findPageInfoByCondition(HouseQO houseQO);

    List<House> findAll();

    List<House> getAllByStatus();

    @Insert("insert into sc_house values(#{houseId},#{houseNo},#{houseArea},#{houseRemark},0,#{buildingId})")
    void add(House house);

    void update1(House house);

    @Delete("delete from sc_house where house_id = #{id}")
    void del(String id);

    @Select("select house_status from sc_house where house_id = #{id}")
    int getStatuseById(String id);

    List<House> getOwnerHouses(String id);

    @Update("update sc_house set house_status = #{status} where house_id = #{id}")
    void updateHouseStatusById(String id, String status);
}
